import { configureStore, combineReducers } from "@reduxjs/toolkit";

// 引入拆分出去的 reducer
import appReducer from "./features/app-slice.ts";
import userReducer from "./features/user-slice.ts";

// 组装成一个 rootReducer
const rootReducer = combineReducers({
  app: appReducer,
  user: userReducer,
});

// 创建 store
const store = configureStore({
  reducer: rootReducer,
});

// 导出两个类型
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;

// 导出 store
export default store;
